1 'CHECKERS
2 KEY OFF:SCREEN 0,1,0:WIDTH 40:COLOR 15,1,9:CLS:DEFINT A-Z
4 GOSUB 4600
5 PRINT"KEY"STRING$(37,"THEN")"CLOSE
10 PRINT"OPEN"SPACE$(14)"CHECKERS"SPACE$(15)"OPEN
15 PRINT"SCREEN"STRING$(37,"THEN")"LOAD
20 PRINT:PRINT"THIS IS THE GAME OF CHECKERS.":PRINT
21 PRINT"THE COMPUTER IS GREEN, AND YOU ARE RED.
25 PRINT:PRINT"TO MOVE, MOVE THE CURSOR ON THE DEFSNGFROMDEFDBL
30 PRINT"SQUARE WITH THE NUMERIC KEY PAD.  PRESS
35 PRINT"<ENTER> TO ACCEPT YOUR MOVE.  THEN MOVE
40 PRINT"TO THE DEFSNGTODEFDBL SQUARE.  THE COORDINATES OF
45 PRINT"YOUR MOVE WILL BE SHOWN ON THE LEFT.
50 PRINT:PRINT"WHEN JUMPING, THE COMPUTER WILL SHOW
55 PRINT"DEFSNG& TODEFDBL SO YOU CAN CONTINUE JUMPING.  TO
60 PRINT"QUIT A SERIES OF JUMPS, PRESS THE <+>
65 PRINT"KEY.  TO START A MOVE OVER, PRESS "CHR$(17)"-"
67 PRINT"(BACKSPACE).  TO QUIT, PRESS <ESC>.
70 GOSUB 4650
80 DIM R(4),S(7,7),CP(11):G=-1:R(0)=-99
110 FOR X=0 TO 6 STEP 2:S(X,0)=1:S(X+1,1)=1:S(X,2)=1:S(X+1,5)=-1:S(X,6)=-1:S(X+1,7)=-1:NEXT
120 CP(0)=16:CP(1)=8:FOR X=2 TO 11:CP(X)=-1:NEXT
150 SCREEN 1,0:COLOR 1,1:OUT 985,49'MAKE FOREGROUND BRIGHTER
180 GOSUB 3000
190 LOCATE 25,1:PRINT"DO YOU WANT TO MOVE FIRST?_";
192 A$="":WHILE+ A$="":A$=INKEY$:WEND
200 IF A$="Y" OR A$="y" THEN LINE(0,192)-(319,199),0,BF:GOTO 1590
210 IF A$<>"N" AND A$<>"n" THEN 192
220 LINE(0,192)-(319,199),0,BF
230 FOR X=0 TO 7:FOR Y=0 TO 7:IF S(X,Y)>-1 THEN 350
310 IF S(X,Y)=-1 THEN FOR A=-1 TO 1 STEP 2:B=G:GOSUB 650:NEXT A
330 IF S(X,Y)=-2 THEN FOR A=-1 TO 1 STEP 2:FOR B=-1 TO 1 STEP 2:GOSUB 650:NEXT B,A
350 NEXT Y,X:GOSUB 3000:GOTO 1140
650 U=X+A:V=Y+B:IF U<0 OR U>7 OR V<0 OR V>7 THEN 870
740 IF S(U,V)=0 THEN GOSUB 910:GOTO 870
770 IF S(U,V)<0 THEN 870
790 U=U+A:V=V+B:IF U<0 OR V<0 OR U>7 OR V>7 THEN 870
850 IF S(U,V)=0 THEN GOSUB 910
870 RETURN
910 IF V=0 AND S(X,Y)=-1 THEN Q=Q+2
920 IF ABS(Y-V)=2 THEN Q=Q+5
960 IF Y=7 THEN Q=Q-2
980 IF Y=0 OR U=7 THEN Q=Q+1
1030 FOR C=-1 TO 1 STEP 2:IF U+C<0 OR U+C>0 OR V+G<0 THEN 1080
1035 IF S(U+C,V+G)<0 THEN Q=Q+1:GOTO 1080
1040 IF U-C<0 OR U-C>7 OR V-G>7 THEN 1080
1045 IF S(U+C,V+G)>0 AND (S(U-C,V-G)=0 OR (U-C=X AND V-G=Y)) THEN Q=Q-2
1080 NEXT C:IF Q>R(0) THEN R(0)=Q:R(1)=X:R(2)=Y:R(3)=U:R(4)=V
1100 Q=0:RETURN
1140 IF R(0)=-99 THEN 1880
1220 LINE(240,16)-(319,111),0,BF
1230 LOCATE 1,30:PRINT"MY FROM:":LOCATE 3,30:PRINT"FROM "CHR$(65+R(1))","CHR$(49+R(2)):LOCATE ,30:PRINT"  TO "CHR$(65+R(3))","CHR$(49+R(4)):R(0)=-99
1240 IF R(4)=0 THEN S(R(3),R(4))=-2:GOTO 1310
1250 S(R(3),R(4))=S(R(1),R(2))
1310 S(R(1),R(2))=0:IF ABS(R(1)-R(3))<>2 THEN GOSUB 3000:GOTO 1590
1330 S((R(1)+R(3))/2,(R(2)+R(4))/2)=0
1340 X=R(3):Y=R(4):IF S(X,Y)=-1 THEN B=-2:FOR A=-2 TO 2 STEP 4:GOSUB 1370:NEXT A
1350 IF S(X,Y)=-2 THEN FOR A=-2 TO 2 STEP 4:FOR B=-2 TO 2 STEP 4:GOSUB 1360:NEXT B,A
1360 IF R(0)<>-99 THEN LOCATE ,30:PRINT"  TO "CHR$(65+R(3))","CHR$(49+R(4)):R(0)=-99:GOTO 1240
1365 GOSUB 3000:GOTO 1590
1370 U=X+A:V=Y+B:IF U<0 OR U>7 OR V<0 OR V>7 THEN 1400
1380 IF S(U,V)=0 AND S(X+A/2,Y+B/2)>0 THEN GOSUB 910
1400 RETURN
1580 GOSUB 3000
1590 LOCATE 1,1:PRINT"YOUR MOVE:
1592 LINE(0,16)-(95,111),0,BF
1595 LOCATE 3,1:PRINT"FROM "CHR$(65+CO)","CHR$(49+DO);
1600 GOSUB 4000:E=C:H=D:IF E<0 OR H<0 THEN 1580
1602 LINE(0,192)-(319,199),0,BF
1610 X=E:Y=H:IF S(X,Y)<0 THEN BEEP:LOCATE 25,1:PRINT"PLAY YOUR OWN PIECES!";:GOTO 1595
1615 IF S(X,Y)=0 THEN BEEP:LOCATE 25,1:PRINT"THAT'S AN EMPTY SQUARE, TRY AGAIN!";:GOTO 1595
1620 LOCATE 4,1:PRINT"  TO "CHR$(65+C)","CHR$(49+D);:GOSUB 4000:A=C:B=D
1630 IF A<0 OR B<0 THEN SOUND 37,2:GOTO 1580
1670 X=A:Y=B
1680 IF S(X,Y)=0 AND ABS(A-E)<=2 AND ABS(A-E)=ABS(B-H) THEN 1700
1690 BEEP:GOTO 1620
1700 I=46
1750 S(A,B)=S(E,H):S(E,H)=0:IF ABS(E-A)<>2 THEN 1810
1800 S((E+A)/2,(H+B)/2)=0
1801 PRINT
1802 LOCATE ,1:PRINT"& TO    ";:GOSUB 4000:A1=C:B1=D:IF K$="+" THEN 1810
1803 IF K$=CHR$(8) THEN SOUND 37,2:GOTO 1580
1804 IF S(A1,B1)<>0 OR ABS(A1-A)<>2 OR ABS(B1-B)<>2 THEN 1802
1806 E=A:H=B:A=A1:B=B1:I=I+15:GOTO 1750
1810 IF B=7 THEN S(A,B)=2
1830 GOTO 230
1880 PLAY"T240C8D8E8G4E8G2
1890 LOCATE 25,16:PRINT"YOU WIN!";
1900 GOTO 9000
2000 SCREEN 1,0:COLOR 1,1:C=-1:OUT 985,49'MAKE FOREGROUND BRIGHTER
2010 FOR X=0 TO 7:FOR Y=0 TO 7:IF C THEN LINE(X*20+80,Y*20)-(X*20+99,Y*20+19),3,BF
2020 C=NOT C:NEXT:C=NOT C:NEXT:RETURN
3000 FOR Y=0 TO 7:FOR X=0 TO 7:GOSUB 3100:NEXT X,Y
3010 LOCATE 18,8:PRINT CHR$(24)"            <ENTER> ACCEPTS
3020 LOCATE 19,7:PRINT CHR$(27)" "CHR$(26)" MOVES     "CHR$(17)"-      CORRECTS
3030 LOCATE 20,8:PRINT CHR$(25)"            <ESC>   EXITS
3040 LOCATE 22,10:PRINT"<+> ENDS JUMP SERIES
3090 RETURN
3100 ON S(X,Y)+3 GOTO 3120,3130,3110,3150,3140
3110 LINE(X*16+100,116-Y*16)-(X*16+115,131-Y*16),((X XOR Y)AND 1)*3,BF:RETURN
3120 GOSUB 3130:LOCATE 16-Y-Y,X+X+14:PRINT"K";:RETURN
3130 CIRCLE(X*16+107,123-Y*16),7,3,,,1:PAINT(X*16+101,121-Y*16),1,3:RETURN
3140 GOSUB 3150:LOCATE 16-Y-Y,X+X+14:PRINT"K";:RETURN
3150 CIRCLE(X*16+107,123-Y*16),7,3,,,1:PAINT(X*16+101,121-Y*16),2,3:RETURN
4000 T=0
4010 C=CO:D=DO:PUT(C*16+104,120-D*16),CP
4030 GOSUB 4500
4040 CN=C:DN=D
4050 IF CO=CN AND DO=DN THEN 4100
4060 PUT(C*16+104,120-D*16),CP
4090 CO=CN:DO=DN:T=TN
4100 IF K$=CHR$(8) OR K$="+" THEN C=-1
4110 IF C<0 THEN PUT(CN*16+104,120-D*16),CP
4150 RETURN
4500 MF=0:K$=INKEY$:IF K$="" THEN 4500
4510 CT=C:DT=D
4520 IF K$=CHR$(13) OR K$=CHR$(8) OR K$="+" THEN RETURN
4525 IF K$=CHR$(27) THEN 4800
4530 IF K$=CHR$(0)+"H" OR K$="8" THEN D=(D+1) AND 7:MF=-1
4540 IF K$=CHR$(0)+"P" OR K$="2" THEN D=(D-1) AND 7:MF=-1
4550 IF K$=CHR$(0)+"K" OR K$="4" THEN C=(C-1) AND 7:MF=-1
4560 IF K$=CHR$(0)+"M" OR K$="6" THEN C=(C+1) AND 7:MF=-1
4570 IF MF THEN SOUND 32767,1:PUT(CT*16+104,120-DT*16),CP:PUT(C*16+104,120-D*16),CP:SOUND 37,0:LOCATE ,6:PRINT CHR$(65+C)","CHR$(49+D);
4590 GOTO 4500
4600  REM  TITLE PAGE ROUTINE.
4606 LOCATE 3,1:CT$="* CHECKERS *":GOSUB 4700
4614  PRINT:PRINT:PRINT:CT$="A VERY GOOD GAME OF CHECKERS":GOSUB 4700
4616 CT$="TO PLAY WITH YOUR IBM PC":GOSUB 4700
4650 LOCATE 24,1:PRINT"PRESS <SPACE> TO CONTINUE";
4660 LOCATE 25,1:PRINT"PRESS <ESC> TO EXIT";
4670 K$=INKEY$:IF K$="" THEN 4670
4680 IF K$=CHR$(27) THEN 9000
4690 IF K$<>" " THEN 4670 :ELSE CLS:RETURN
4700 LOCATE ,20.5!-LEN(CT$)\2
4710 PRINT CT$:RETURN
4800 LOCATE 25,1:PRINT"<SPACE> TO CONTINUE, <ESC> TO EXIT";
4810 K$=INKEY$:IF K$="" THEN 4810
4820 IF K$=CHR$(27) THEN RUN
4830 IF K$<>" " THEN 4830 :ELSE CLS:K$="+":RETURN
9000 GOSUB 4650:RUN
